//
//  CustomTableViewCell.m
//  17作业
//
//  Created by dllo on 16/8/7.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "CustomTableViewCell.h"

@implementation CustomTableViewCell



- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _nameLabel = [[UILabel alloc] init];
//        _nameLabel.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_nameLabel];
        _phoneNumberLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_phoneNumberLabel];
        _genderLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_genderLabel];
        _ageLabel = [[UILabel alloc] init];
        [[self contentView] addSubview:_ageLabel];
        _userImageView = [[UIImageView alloc] init];
        [[self contentView] addSubview:_userImageView];
    }
    return self;
}

- (void)setModel:(Model *)model
{
    _model = model;
    _nameLabel.text = _model.name;
    _phoneNumberLabel.text = _model.phoneNumber;
    _genderLabel.text = _model.gender;
    _ageLabel.text = _model.age;
    _userImageView.image = [UIImage imageNamed:@"0"];
}
//- (Model *)model
//{
//    return _nameLabel;
//}

- (void)layoutSubviews
{
    [super layoutSubviews];
    _nameLabel.frame = CGRectMake(10, 14, 80, 20);
    _phoneNumberLabel.frame = CGRectMake(120, 10, 150, 20);
    _genderLabel.frame = CGRectMake(10, 44, 30, 20);
    _ageLabel.frame = CGRectMake(50, 44, 30, 20);
    _userImageView.frame = CGRectMake(305, 10, 60, 60);
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
